package com.boarsoft.message.bean;

import java.io.Serializable;
import java.util.Date;

/**
 * 收件人状态是针对收件人而言的消息状态，要么成功，要么失败，要么还未发送
 * 
 * @author Mac_J
 *
 */
public class RecipientStatus implements Serializable {
	private static final long serialVersionUID = -2810079493984424570L;

	/** 未完成状态，指消息正在收件人消息队列等待发送，或者正在发送 */
	public static final short PENDING = 0;
	/** 全部都成功了 */
	public static final short SUCCESS = 1;
	/** 尝试N次都失败了，且不需要重试 */
	public static final short FAILED = 2;

	/** 是否必须送达 */
	protected boolean required = true;
	protected short status = PENDING;
	protected int tried;
	protected String memo = "new";
	protected Date time = new Date();

	public RecipientStatus() {
	}

	public RecipientStatus(boolean required) {
		this.required = required;
	}

	public void setStatus(short status, String memo) {
		this.status = status;
		this.memo = memo;
		this.time = new Date();
	}

	public int tried1() {
		tried++;
		return tried;
	}

	public boolean isRequired() {
		return required;
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	public short getStatus() {
		return status;
	}

	public void setStatus(short status) {
		this.status = status;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public int getTried() {
		return tried;
	}

	public void setTried(int tried) {
		this.tried = tried;
	}
}
